package vehicles.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import vehicles.processing.*;
import vehicles.*;
import javax.swing.AbstractListModel;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ListSelectionModel;
import org.jdesktop.application.Action;
import org.jdesktop.application.Application;
import org.jdesktop.application.ResourceMap;
import vehicles.simulation.*;
import vehicles.vehicle.*;
import vehicles.environment.*;
import vehicles.genetics.*;
import vehicles.util.UtilMethods;


/*
 * SimulationEditor.java
 *
 * Created on 28-Mar-2009, 14:51:37
 * @author Niall O'Hara
 */
public class SimulationEditor extends javax.swing.JFrame {

    /** Creates new form SimulationEditor */
    public SimulationEditor(java.awt.Frame parent, Simulator p_appRoot) {

        appRoot = p_appRoot;
        simulationArray = appRoot.getSimulationArray();
        simulationDropDown = new DefaultComboBoxModel(simulationArray);

        genSelArray = new GeneticSelectionMethod[]{new GeneticSelectionMethod(1),
        new GeneticSelectionMethod(2),
        new GeneticSelectionMethod(3),
        new GeneticSelectionMethod(4),
        new GeneticSelectionMethod(5)};
        genSelDropDown = new DefaultComboBoxModel(genSelArray);

        repoArray = new ReproductionMethod[]{new ReproductionMethod(1),
        new ReproductionMethod(2)};
        repoDropDown = new DefaultComboBoxModel(repoArray);

        proVehiclePreview = new VehiclePreview();
      

        // important to call this whenever embedding a PApplet.
        // It ensures that the animation thread is started and
        // that other internal variables are properly set.
        proVehiclePreview.init();
        

        environmentArray = appRoot.getEnvironmentArray();
        for (int i = 0; i < environmentArray.length; i++) {
            availableEnv.add(i, environmentArray[i]);
        }
        proEnvironmentPreview = new EnvironmentPreview(environmentArray[0]);
        proEnvironmentPreview.init();

        availableEnvironments = new AvailableEnvironmentsModel();
        selectedEnvironments = new SelectedEnvironmentsModel();

        vehicleArray = appRoot.getVehicleArray();
        for (int i = 0; i < vehicleArray.length; i++) {
            availableRobots.add(i, vehicleArray[i]);
        }
        
        availableVehicles = new AvailableRobotsModel();
        selectedVehicles = new SelectedRobotsModel();

        initComponents();

        populateFields(simulationArray[0]);
        
        proVehiclePreview.updateSize(processing_VehiclePreview.getWidth(), processing_VehiclePreview.getHeight());
    }

    @Action public void cancel() {
        dispose();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup_Evolution = new ButtonGroup();
        buttonGroup_PerishableVehicles = new ButtonGroup();
        panel_SelectedSimulation = new JPanel();
        dropdown_SelectedSimulation = new JComboBox();
        tabContainer = new JTabbedPane();
        tab_Properties = new JPanel();
        panel_Name = new JPanel();
        text_Name = new JTextField();
        panel_Configuration = new JPanel();
        panel_Evolution = new JPanel();
        radio_Evolution_On = new JRadioButton();
        radio_Evolution_Off = new JRadioButton();
        label_ReproductionMethod = new JLabel();
        dropdown_ReproductionMethod = new JComboBox();
        label_GeneticSelectionMethod = new JLabel();
        dropdown_GeneticSelectionMethod = new JComboBox();
        label_GeneticSelectionN = new JLabel();
        text_GeneticSelectionN = new JTextField();
        panel_PerishableVehicles = new JPanel();
        radio_Perishable_On = new JRadioButton();
        radio_Perishable_Off = new JRadioButton();
        panel_Description = new JPanel();
        scrollpanel_Description = new JScrollPane();
        text_Description = new JTextArea();
        panel_Author = new JPanel();
        text_Author = new JTextField();
        panel_LastModified = new JPanel();
        text_LastModified = new JTextField();
        tab_Vehicles = new JPanel();
        panel_AvailableVehicles = new JPanel();
        scrollpanel_AvailableVehicles = new JScrollPane();
        list_AvailableVehicles = new JList();
        button_ReloadVeh = new JButton();
        panel_AddRemoveVehicles = new JPanel();
        button_AddVehicle = new JButton();
        button_AddAllVehicle = new JButton();
        button_RemoveVehicle = new JButton();
        button_RemoveAllVehicle = new JButton();
        panel_VehiclePreview = new JPanel();
        jScrollPane1 = new JScrollPane();
        jTextArea1 = new JTextArea();
        processing_VehiclePreview = new JPanel();
        panel_SelectedVehicles = new JPanel();
        scrollpanel_SelectedVehicles = new JScrollPane();
        list_SelectedVehicles = new JList();
        tab_Environment = new JPanel();
        panel_AvailableEnvironments = new JPanel();
        scrollpanel_AvailableEnvironments = new JScrollPane();
        list_AvailableEnvironments = new JList();
        button_ReloadEnv = new JButton();
        panel_SelectedEnvironment = new JPanel();
        scrollpanel_SelectedEnvironment = new JScrollPane();
        list_SelectedEnvironment = new JList();
        panel_SetEnvironment = new JPanel();
        button_SetEnvironment = new JButton();
        panel_EnvironmentPreview = new JPanel();
        processing_EnvironmentPreview = new JPanel();
        jScrollPane2 = new JScrollPane();
        jTextArea2 = new JTextArea();
        text_Status = new JTextField();
        button_Save = new JButton();
        button_SaveAsNew = new JButton();
        button_Cancel = new JButton();

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        ResourceMap resourceMap = Application.getInstance(VehiclesApp.class).getContext().getResourceMap(SimulationEditor.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setMinimumSize(new Dimension(620, 560));
        setName("Form"); // NOI18N
        addWindowFocusListener(new WindowFocusListener() {
            public void windowGainedFocus(WindowEvent evt) {
                formWindowGainedFocus(evt);
            }
            public void windowLostFocus(WindowEvent evt) {
            }
        });

        panel_SelectedSimulation.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_SelectedSimulation.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_SelectedSimulation.border.titleFont"))); // NOI18N
        panel_SelectedSimulation.setName("panel_SelectedSimulation"); // NOI18N

        dropdown_SelectedSimulation.setMaximumRowCount(4);
        dropdown_SelectedSimulation.setModel(simulationDropDown);
        dropdown_SelectedSimulation.setName("dropdown_SelectedSimulation"); // NOI18N
        dropdown_SelectedSimulation.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
                dropdown_SelectedSimulationItemStateChanged(evt);
            }
        });

        GroupLayout panel_SelectedSimulationLayout = new GroupLayout(panel_SelectedSimulation);
        panel_SelectedSimulation.setLayout(panel_SelectedSimulationLayout);
        panel_SelectedSimulationLayout.setHorizontalGroup(
            panel_SelectedSimulationLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(dropdown_SelectedSimulation, 0, 588, Short.MAX_VALUE)
        );
        panel_SelectedSimulationLayout.setVerticalGroup(
            panel_SelectedSimulationLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(dropdown_SelectedSimulation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        tabContainer.setName("tabContainer"); // NOI18N

        tab_Properties.setName("tab_Properties"); // NOI18N

        panel_Name.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Name.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Name.border.titleFont"))); // NOI18N
        panel_Name.setName("panel_Name"); // NOI18N

        text_Name.setText(resourceMap.getString("text_Name.text")); // NOI18N
        text_Name.setName("text_Name"); // NOI18N

        GroupLayout panel_NameLayout = new GroupLayout(panel_Name);
        panel_Name.setLayout(panel_NameLayout);
        panel_NameLayout.setHorizontalGroup(
            panel_NameLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Name, GroupLayout.DEFAULT_SIZE, 267, Short.MAX_VALUE)
        );
        panel_NameLayout.setVerticalGroup(
            panel_NameLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Name, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        panel_Configuration.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Configuration.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Configuration.border.titleFont"))); // NOI18N
        panel_Configuration.setName("panel_Configuration"); // NOI18N

        panel_Evolution.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("panel_Evolution.border.title"))); // NOI18N
        panel_Evolution.setName("panel_Evolution"); // NOI18N
        panel_Evolution.setPreferredSize(new Dimension(313, 101));

        ActionMap actionMap = Application.getInstance(VehiclesApp.class).getContext().getActionMap(SimulationEditor.class, this);
        radio_Evolution_On.setAction(actionMap.get("evolutionOn")); // NOI18N
        buttonGroup_Evolution.add(radio_Evolution_On);
        radio_Evolution_On.setText(resourceMap.getString("radio_Evolution_On.text")); // NOI18N
        radio_Evolution_On.setName("radio_Evolution_On"); // NOI18N
        radio_Evolution_On.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
                radio_Evolution_OnItemStateChanged(evt);
            }
        });

        radio_Evolution_Off.setAction(actionMap.get("evolutionOff")); // NOI18N
        buttonGroup_Evolution.add(radio_Evolution_Off);
        radio_Evolution_Off.setSelected(true);
        radio_Evolution_Off.setText(resourceMap.getString("radio_Evolution_Off.text")); // NOI18N
        radio_Evolution_Off.setName("radio_Evolution_Off"); // NOI18N

        label_ReproductionMethod.setHorizontalAlignment(SwingConstants.RIGHT);
        label_ReproductionMethod.setText(resourceMap.getString("label_ReproductionMethod.text")); // NOI18N
        label_ReproductionMethod.setName("label_ReproductionMethod"); // NOI18N

        dropdown_ReproductionMethod.setModel(repoDropDown);
        dropdown_ReproductionMethod.setEnabled(false);
        dropdown_ReproductionMethod.setName("dropdown_ReproductionMethod"); // NOI18N
        dropdown_ReproductionMethod.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
                dropdown_ReproductionMethodItemStateChanged(evt);
            }
        });

        label_GeneticSelectionMethod.setText(resourceMap.getString("label_GeneticSelectionMethod.text")); // NOI18N
        label_GeneticSelectionMethod.setName("label_GeneticSelectionMethod"); // NOI18N

        dropdown_GeneticSelectionMethod.setModel(genSelDropDown);
        dropdown_GeneticSelectionMethod.setEnabled(false);
        dropdown_GeneticSelectionMethod.setName("dropdown_GeneticSelectionMethod"); // NOI18N
        dropdown_GeneticSelectionMethod.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent evt) {
                dropdown_GeneticSelectionMethodItemStateChanged(evt);
            }
        });

        label_GeneticSelectionN.setText(resourceMap.getString("label_GeneticSelectionN.text")); // NOI18N
        label_GeneticSelectionN.setName("label_GeneticSelectionN"); // NOI18N

        text_GeneticSelectionN.setText(resourceMap.getString("text_GeneticSelectionN.text")); // NOI18N
        text_GeneticSelectionN.setEnabled(false);
        text_GeneticSelectionN.setName("text_GeneticSelectionN"); // NOI18N

        GroupLayout panel_EvolutionLayout = new GroupLayout(panel_Evolution);
        panel_Evolution.setLayout(panel_EvolutionLayout);
        panel_EvolutionLayout.setHorizontalGroup(
            panel_EvolutionLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_EvolutionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(panel_EvolutionLayout.createSequentialGroup()
                        .addComponent(radio_Evolution_On)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(radio_Evolution_Off)
                        .addPreferredGap(ComponentPlacement.RELATED, 182, Short.MAX_VALUE))
                    .addGroup(panel_EvolutionLayout.createSequentialGroup()
                        .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.LEADING, false)
                            .addComponent(label_GeneticSelectionMethod, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(label_GeneticSelectionN, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(label_ReproductionMethod, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.TRAILING)
                            .addComponent(dropdown_GeneticSelectionMethod, Alignment.LEADING, 0, 129, Short.MAX_VALUE)
                            .addComponent(dropdown_ReproductionMethod, Alignment.LEADING, 0, 129, Short.MAX_VALUE)
                            .addComponent(text_GeneticSelectionN, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE))))
                .addContainerGap())
        );
        panel_EvolutionLayout.setVerticalGroup(
            panel_EvolutionLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_EvolutionLayout.createSequentialGroup()
                .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(radio_Evolution_On)
                    .addComponent(radio_Evolution_Off))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(dropdown_ReproductionMethod, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(label_ReproductionMethod))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(dropdown_GeneticSelectionMethod, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(label_GeneticSelectionMethod))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(panel_EvolutionLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(text_GeneticSelectionN, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
                    .addComponent(label_GeneticSelectionN)))
        );

        panel_PerishableVehicles.setBorder(BorderFactory.createTitledBorder(resourceMap.getString("panel_PerishableVehicles.border.title"))); // NOI18N
        panel_PerishableVehicles.setName("panel_PerishableVehicles"); // NOI18N

        buttonGroup_PerishableVehicles.add(radio_Perishable_On);
        radio_Perishable_On.setText(resourceMap.getString("radio_Perishable_On.text")); // NOI18N
        radio_Perishable_On.setName("radio_Perishable_On"); // NOI18N

        buttonGroup_PerishableVehicles.add(radio_Perishable_Off);
        radio_Perishable_Off.setSelected(true);
        radio_Perishable_Off.setText(resourceMap.getString("radio_Perishable_Off.text")); // NOI18N
        radio_Perishable_Off.setName("radio_Perishable_Off"); // NOI18N

        GroupLayout panel_PerishableVehiclesLayout = new GroupLayout(panel_PerishableVehicles);
        panel_PerishableVehicles.setLayout(panel_PerishableVehiclesLayout);
        panel_PerishableVehiclesLayout.setHorizontalGroup(
            panel_PerishableVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_PerishableVehiclesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(radio_Perishable_On)
                .addGap(5, 5, 5)
                .addComponent(radio_Perishable_Off)
                .addContainerGap(178, Short.MAX_VALUE))
        );
        panel_PerishableVehiclesLayout.setVerticalGroup(
            panel_PerishableVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_PerishableVehiclesLayout.createSequentialGroup()
                .addGroup(panel_PerishableVehiclesLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(radio_Perishable_Off)
                    .addComponent(radio_Perishable_On))
                .addContainerGap(78, Short.MAX_VALUE))
        );

        GroupLayout panel_ConfigurationLayout = new GroupLayout(panel_Configuration);
        panel_Configuration.setLayout(panel_ConfigurationLayout);
        panel_ConfigurationLayout.setHorizontalGroup(
            panel_ConfigurationLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_ConfigurationLayout.createSequentialGroup()
                .addComponent(panel_Evolution, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_PerishableVehicles, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panel_ConfigurationLayout.setVerticalGroup(
            panel_ConfigurationLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_ConfigurationLayout.createSequentialGroup()
                .addGroup(panel_ConfigurationLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_PerishableVehicles, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_Evolution, GroupLayout.DEFAULT_SIZE, 127, Short.MAX_VALUE))
                .addContainerGap())
        );

        panel_Description.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Description.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Description.border.titleFont"))); // NOI18N
        panel_Description.setName("panel_Description"); // NOI18N

        scrollpanel_Description.setName("scrollpanel_Description"); // NOI18N

        text_Description.setColumns(20);
        text_Description.setFont(resourceMap.getFont("text_Description.font")); // NOI18N
        text_Description.setLineWrap(true);
        text_Description.setRows(5);
        text_Description.setWrapStyleWord(true);
        text_Description.setName("text_Description"); // NOI18N
        scrollpanel_Description.setViewportView(text_Description);

        GroupLayout panel_DescriptionLayout = new GroupLayout(panel_Description);
        panel_Description.setLayout(panel_DescriptionLayout);
        panel_DescriptionLayout.setHorizontalGroup(
            panel_DescriptionLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_Description, GroupLayout.DEFAULT_SIZE, 563, Short.MAX_VALUE)
        );
        panel_DescriptionLayout.setVerticalGroup(
            panel_DescriptionLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_Description, GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
        );

        panel_Author.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_Author.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_Author.border.titleFont"))); // NOI18N
        panel_Author.setName("panel_Author"); // NOI18N

        text_Author.setText(resourceMap.getString("text_Author.text")); // NOI18N
        text_Author.setName("text_Author"); // NOI18N

        GroupLayout panel_AuthorLayout = new GroupLayout(panel_Author);
        panel_Author.setLayout(panel_AuthorLayout);
        panel_AuthorLayout.setHorizontalGroup(
            panel_AuthorLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Author, GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
        );
        panel_AuthorLayout.setVerticalGroup(
            panel_AuthorLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_Author, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        panel_LastModified.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_LastModified.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_LastModified.border.titleFont"))); // NOI18N
        panel_LastModified.setName("panel_LastModified"); // NOI18N

        text_LastModified.setEditable(false);
        text_LastModified.setBorder(BorderFactory.createEmptyBorder(1, 4, 1, 1));
        text_LastModified.setName("text_LastModified"); // NOI18N

        GroupLayout panel_LastModifiedLayout = new GroupLayout(panel_LastModified);
        panel_LastModified.setLayout(panel_LastModifiedLayout);
        panel_LastModifiedLayout.setHorizontalGroup(
            panel_LastModifiedLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_LastModified, GroupLayout.DEFAULT_SIZE, 563, Short.MAX_VALUE)
        );
        panel_LastModifiedLayout.setVerticalGroup(
            panel_LastModifiedLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(text_LastModified, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        );

        GroupLayout tab_PropertiesLayout = new GroupLayout(tab_Properties);
        tab_Properties.setLayout(tab_PropertiesLayout);
        tab_PropertiesLayout.setHorizontalGroup(
            tab_PropertiesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, tab_PropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_PropertiesLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_Description, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_Configuration, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_LastModified, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(tab_PropertiesLayout.createSequentialGroup()
                        .addComponent(panel_Name, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(panel_Author, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        tab_PropertiesLayout.setVerticalGroup(
            tab_PropertiesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(tab_PropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_PropertiesLayout.createParallelGroup(Alignment.CENTER)
                    .addComponent(panel_Name, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(panel_Author, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Configuration, GroupLayout.PREFERRED_SIZE, 152, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_Description, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_LastModified, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tabContainer.addTab(resourceMap.getString("tab_Properties.TabConstraints.tabTitle"), tab_Properties); // NOI18N

        tab_Vehicles.setName("tab_Vehicles"); // NOI18N

        panel_AvailableVehicles.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_AvailableVehicles.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_AvailableVehicles.border.titleFont"))); // NOI18N
        panel_AvailableVehicles.setName("panel_AvailableVehicles"); // NOI18N

        scrollpanel_AvailableVehicles.setName("scrollpanel_AvailableVehicles"); // NOI18N

        list_AvailableVehicles.setModel(availableVehicles);
        list_AvailableVehicles.setName("list_AvailableVehicles"); // NOI18N
        list_AvailableVehicles.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                list_AvailableVehiclesValueChanged(evt);
            }
        });
        scrollpanel_AvailableVehicles.setViewportView(list_AvailableVehicles);

        button_ReloadVeh.setAction(actionMap.get("reloadVehiclesList")); // NOI18N
        button_ReloadVeh.setText(resourceMap.getString("button_ReloadVeh.text")); // NOI18N
        button_ReloadVeh.setName("button_ReloadVeh"); // NOI18N

        GroupLayout panel_AvailableVehiclesLayout = new GroupLayout(panel_AvailableVehicles);
        panel_AvailableVehicles.setLayout(panel_AvailableVehiclesLayout);
        panel_AvailableVehiclesLayout.setHorizontalGroup(
            panel_AvailableVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_AvailableVehicles, GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
            .addComponent(button_ReloadVeh, GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
        );
        panel_AvailableVehiclesLayout.setVerticalGroup(
            panel_AvailableVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_AvailableVehiclesLayout.createSequentialGroup()
                .addComponent(scrollpanel_AvailableVehicles, GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(button_ReloadVeh))
        );

        panel_AddRemoveVehicles.setName("panel_AddRemoveVehicles"); // NOI18N

        button_AddVehicle.setAction(actionMap.get("addSelectedVehicles")); // NOI18N
        button_AddVehicle.setText(resourceMap.getString("button_AddVehicle.text")); // NOI18N
        button_AddVehicle.setName("button_AddVehicle"); // NOI18N

        button_AddAllVehicle.setAction(actionMap.get("addAllVehicles")); // NOI18N
        button_AddAllVehicle.setText(resourceMap.getString("button_AddAllVehicle.text")); // NOI18N
        button_AddAllVehicle.setName("button_AddAllVehicle"); // NOI18N

        button_RemoveVehicle.setAction(actionMap.get("removeSelectedVehicles")); // NOI18N
        button_RemoveVehicle.setText(resourceMap.getString("button_RemoveVehicle.text")); // NOI18N
        button_RemoveVehicle.setName("button_RemoveVehicle"); // NOI18N

        button_RemoveAllVehicle.setAction(actionMap.get("removeAllVehicles")); // NOI18N
        button_RemoveAllVehicle.setText(resourceMap.getString("button_RemoveAllVehicle.text")); // NOI18N
        button_RemoveAllVehicle.setName("button_RemoveAllVehicle"); // NOI18N

        panel_VehiclePreview.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_VehiclePreview.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_VehiclePreview.border.titleFont"))); // NOI18N
        panel_VehiclePreview.setName("panel_VehiclePreview"); // NOI18N

        jScrollPane1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setFont(resourceMap.getFont("jTextArea1.font")); // NOI18N
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setWrapStyleWord(true);
        jTextArea1.setAutoscrolls(false);
        jTextArea1.setBorder(null);
        jTextArea1.setName("jTextArea1"); // NOI18N
        jScrollPane1.setViewportView(jTextArea1);

        processing_VehiclePreview.setBackground(resourceMap.getColor("processing_VehiclePreview.background")); // NOI18N
        processing_VehiclePreview.setName("processing_VehiclePreview"); // NOI18N
        processing_VehiclePreview.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                processing_VehiclePreviewComponentResized(evt);
            }
        });
        processing_VehiclePreview.setLayout(new BorderLayout());

        GroupLayout panel_VehiclePreviewLayout = new GroupLayout(panel_VehiclePreview);
        panel_VehiclePreview.setLayout(panel_VehiclePreviewLayout);
        panel_VehiclePreviewLayout.setHorizontalGroup(
            panel_VehiclePreviewLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
            .addComponent(processing_VehiclePreview, GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE)
        );
        panel_VehiclePreviewLayout.setVerticalGroup(
            panel_VehiclePreviewLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_VehiclePreviewLayout.createSequentialGroup()
                .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(processing_VehiclePreview, GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE))
        );

        processing_VehiclePreview.add(proVehiclePreview, BorderLayout.CENTER);

        GroupLayout panel_AddRemoveVehiclesLayout = new GroupLayout(panel_AddRemoveVehicles);
        panel_AddRemoveVehicles.setLayout(panel_AddRemoveVehiclesLayout);
        panel_AddRemoveVehiclesLayout.setHorizontalGroup(
            panel_AddRemoveVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_AddRemoveVehiclesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panel_AddRemoveVehiclesLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(button_AddVehicle, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                    .addComponent(button_AddAllVehicle, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                    .addComponent(button_RemoveVehicle, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                    .addComponent(button_RemoveAllVehicle, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                    .addComponent(panel_VehiclePreview, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        panel_AddRemoveVehiclesLayout.setVerticalGroup(
            panel_AddRemoveVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_AddRemoveVehiclesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(button_AddVehicle)
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addComponent(button_AddAllVehicle)
                .addGap(18, 18, 18)
                .addComponent(panel_VehiclePreview, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(button_RemoveVehicle)
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addComponent(button_RemoveAllVehicle)
                .addContainerGap())
        );

        panel_SelectedVehicles.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_SelectedVehicles.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_SelectedVehicles.border.titleFont"))); // NOI18N
        panel_SelectedVehicles.setName("panel_SelectedVehicles"); // NOI18N

        scrollpanel_SelectedVehicles.setName("scrollpanel_SelectedVehicles"); // NOI18N

        list_SelectedVehicles.setModel(selectedVehicles);
        list_SelectedVehicles.setName("list_SelectedVehicles"); // NOI18N
        scrollpanel_SelectedVehicles.setViewportView(list_SelectedVehicles);

        GroupLayout panel_SelectedVehiclesLayout = new GroupLayout(panel_SelectedVehicles);
        panel_SelectedVehicles.setLayout(panel_SelectedVehiclesLayout);
        panel_SelectedVehiclesLayout.setHorizontalGroup(
            panel_SelectedVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_SelectedVehicles, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 177, Short.MAX_VALUE)
        );
        panel_SelectedVehiclesLayout.setVerticalGroup(
            panel_SelectedVehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_SelectedVehicles, GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE)
        );

        GroupLayout tab_VehiclesLayout = new GroupLayout(tab_Vehicles);
        tab_Vehicles.setLayout(tab_VehiclesLayout);
        tab_VehiclesLayout.setHorizontalGroup(
            tab_VehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, tab_VehiclesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_AvailableVehicles, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_AddRemoveVehicles, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(panel_SelectedVehicles, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        tab_VehiclesLayout.setVerticalGroup(
            tab_VehiclesLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, tab_VehiclesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_VehiclesLayout.createParallelGroup(Alignment.TRAILING)
                    .addComponent(panel_SelectedVehicles, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_AvailableVehicles, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panel_AddRemoveVehicles, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        tabContainer.addTab(resourceMap.getString("tab_Vehicles.TabConstraints.tabTitle"), tab_Vehicles); // NOI18N

        tab_Environment.setName("tab_Environment"); // NOI18N
        tab_Environment.addFocusListener(new FocusAdapter() {
            public void focusGained(FocusEvent evt) {
                tab_EnvironmentFocusGained(evt);
            }
            public void focusLost(FocusEvent evt) {
                tab_EnvironmentFocusLost(evt);
            }
        });

        panel_AvailableEnvironments.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_AvailableEnvironments.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_AvailableEnvironments.border.titleFont"))); // NOI18N
        panel_AvailableEnvironments.setName("panel_AvailableEnvironments"); // NOI18N
        panel_AvailableEnvironments.setPreferredSize(new Dimension(210, 363));

        scrollpanel_AvailableEnvironments.setName("scrollpanel_AvailableEnvironments"); // NOI18N

        list_AvailableEnvironments.setModel(availableEnvironments);
        list_AvailableEnvironments.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        list_AvailableEnvironments.setName("list_AvailableEnvironments"); // NOI18N
        list_AvailableEnvironments.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                list_AvailableEnvironmentsValueChanged(evt);
            }
        });
        scrollpanel_AvailableEnvironments.setViewportView(list_AvailableEnvironments);

        button_ReloadEnv.setAction(actionMap.get("reloadEnvironmentsList")); // NOI18N
        button_ReloadEnv.setText(resourceMap.getString("button_ReloadEnv.text")); // NOI18N
        button_ReloadEnv.setName("button_ReloadEnv"); // NOI18N

        GroupLayout panel_AvailableEnvironmentsLayout = new GroupLayout(panel_AvailableEnvironments);
        panel_AvailableEnvironments.setLayout(panel_AvailableEnvironmentsLayout);
        panel_AvailableEnvironmentsLayout.setHorizontalGroup(
            panel_AvailableEnvironmentsLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_AvailableEnvironments, GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
            .addComponent(button_ReloadEnv, GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
        );
        panel_AvailableEnvironmentsLayout.setVerticalGroup(
            panel_AvailableEnvironmentsLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_AvailableEnvironmentsLayout.createSequentialGroup()
                .addComponent(scrollpanel_AvailableEnvironments, GroupLayout.DEFAULT_SIZE, 353, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(button_ReloadEnv))
        );

        panel_SelectedEnvironment.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_SelectedEnvironment.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_SelectedEnvironment.border.titleFont"))); // NOI18N
        panel_SelectedEnvironment.setName("panel_SelectedEnvironment"); // NOI18N

        scrollpanel_SelectedEnvironment.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollpanel_SelectedEnvironment.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        scrollpanel_SelectedEnvironment.setName("scrollpanel_SelectedEnvironment"); // NOI18N

        list_SelectedEnvironment.setModel(selectedEnvironments);
        list_SelectedEnvironment.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        list_SelectedEnvironment.setEnabled(false);
        list_SelectedEnvironment.setName("list_SelectedEnvironment"); // NOI18N
        scrollpanel_SelectedEnvironment.setViewportView(list_SelectedEnvironment);

        GroupLayout panel_SelectedEnvironmentLayout = new GroupLayout(panel_SelectedEnvironment);
        panel_SelectedEnvironment.setLayout(panel_SelectedEnvironmentLayout);
        panel_SelectedEnvironmentLayout.setHorizontalGroup(
            panel_SelectedEnvironmentLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_SelectedEnvironment, GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
        );
        panel_SelectedEnvironmentLayout.setVerticalGroup(
            panel_SelectedEnvironmentLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(scrollpanel_SelectedEnvironment, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
        );

        panel_SetEnvironment.setName("panel_SetEnvironment"); // NOI18N

        button_SetEnvironment.setAction(actionMap.get("setEnvironment")); // NOI18N
        button_SetEnvironment.setText(resourceMap.getString("button_SetEnvironment.text")); // NOI18N
        button_SetEnvironment.setName("button_SetEnvironment"); // NOI18N

        GroupLayout panel_SetEnvironmentLayout = new GroupLayout(panel_SetEnvironment);
        panel_SetEnvironment.setLayout(panel_SetEnvironmentLayout);
        panel_SetEnvironmentLayout.setHorizontalGroup(
            panel_SetEnvironmentLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_SetEnvironmentLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(button_SetEnvironment, GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE)
                .addContainerGap())
        );
        panel_SetEnvironmentLayout.setVerticalGroup(
            panel_SetEnvironmentLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, panel_SetEnvironmentLayout.createSequentialGroup()
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(button_SetEnvironment)
                .addContainerGap())
        );

        panel_EnvironmentPreview.setBorder(BorderFactory.createTitledBorder(null, resourceMap.getString("panel_EnvironmentPreview.border.title"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, resourceMap.getFont("panel_EnvironmentPreview.border.titleFont"))); // NOI18N
        panel_EnvironmentPreview.setName("panel_EnvironmentPreview"); // NOI18N

        processing_EnvironmentPreview.setBackground(resourceMap.getColor("processing_EnvironmentPreview.background")); // NOI18N
        processing_EnvironmentPreview.setName("processing_EnvironmentPreview"); // NOI18N
        processing_EnvironmentPreview.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                processing_EnvironmentPreviewComponentResized(evt);
            }
        });
        processing_EnvironmentPreview.setLayout(new BorderLayout());

        jScrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jTextArea2.setColumns(20);
        jTextArea2.setEditable(false);
        jTextArea2.setFont(resourceMap.getFont("jTextArea2.font")); // NOI18N
        jTextArea2.setLineWrap(true);
        jTextArea2.setRows(5);
        jTextArea2.setWrapStyleWord(true);
        jTextArea2.setAutoscrolls(false);
        jTextArea2.setBorder(null);
        jTextArea2.setName("jTextArea2"); // NOI18N
        jScrollPane2.setViewportView(jTextArea2);

        GroupLayout panel_EnvironmentPreviewLayout = new GroupLayout(panel_EnvironmentPreview);
        panel_EnvironmentPreview.setLayout(panel_EnvironmentPreviewLayout);
        panel_EnvironmentPreviewLayout.setHorizontalGroup(
            panel_EnvironmentPreviewLayout.createParallelGroup(Alignment.LEADING)
            .addComponent(jScrollPane2, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
            .addComponent(processing_EnvironmentPreview, GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
        );
        panel_EnvironmentPreviewLayout.setVerticalGroup(
            panel_EnvironmentPreviewLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(panel_EnvironmentPreviewLayout.createSequentialGroup()
                .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(processing_EnvironmentPreview, GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE))
        );

        processing_EnvironmentPreview.add(proEnvironmentPreview, BorderLayout.CENTER);

        GroupLayout tab_EnvironmentLayout = new GroupLayout(tab_Environment);
        tab_Environment.setLayout(tab_EnvironmentLayout);
        tab_EnvironmentLayout.setHorizontalGroup(
            tab_EnvironmentLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(tab_EnvironmentLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_AvailableEnvironments, GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(tab_EnvironmentLayout.createParallelGroup(Alignment.TRAILING)
                    .addGroup(tab_EnvironmentLayout.createSequentialGroup()
                        .addComponent(panel_SetEnvironment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(panel_SelectedEnvironment, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(panel_EnvironmentPreview, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        tab_EnvironmentLayout.setVerticalGroup(
            tab_EnvironmentLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(tab_EnvironmentLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tab_EnvironmentLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(panel_AvailableEnvironments, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)
                    .addGroup(tab_EnvironmentLayout.createSequentialGroup()
                        .addGroup(tab_EnvironmentLayout.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel_SelectedEnvironment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addGroup(tab_EnvironmentLayout.createSequentialGroup()
                                .addGap(5, 5, 5)
                                .addComponent(panel_SetEnvironment, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(panel_EnvironmentPreview, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );

        tabContainer.addTab(resourceMap.getString("tab_Environment.TabConstraints.tabTitle"), tab_Environment); // NOI18N

        text_Status.setEditable(false);
        text_Status.setText(resourceMap.getString("text_Status.text")); // NOI18N
        text_Status.setName("text_Status"); // NOI18N

        button_Save.setAction(actionMap.get("saveSimulation")); // NOI18N
        button_Save.setText(resourceMap.getString("button_Save.text")); // NOI18N
        button_Save.setName("button_Save"); // NOI18N

        button_SaveAsNew.setAction(actionMap.get("saveSimulationAs")); // NOI18N
        button_SaveAsNew.setText(resourceMap.getString("button_SaveAsNew.text")); // NOI18N
        button_SaveAsNew.setName("button_SaveAsNew"); // NOI18N

        button_Cancel.setAction(actionMap.get("cancel")); // NOI18N
        button_Cancel.setText(resourceMap.getString("button_Cancel.text")); // NOI18N
        button_Cancel.setName("button_Cancel"); // NOI18N

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(Alignment.LEADING)
                    .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(text_Status, GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(button_Save)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(button_SaveAsNew)
                        .addPreferredGap(ComponentPlacement.RELATED)
                        .addComponent(button_Cancel))
                    .addComponent(panel_SelectedSimulation, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tabContainer, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(Alignment.LEADING)
            .addGroup(Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panel_SelectedSimulation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addComponent(tabContainer, GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE)
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(button_Cancel)
                    .addComponent(text_Status, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
                    .addComponent(button_SaveAsNew)
                    .addComponent(button_Save))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void dropdown_SelectedSimulationItemStateChanged(ItemEvent evt) {//GEN-FIRST:event_dropdown_SelectedSimulationItemStateChanged
        JComboBox tempComboBox = (JComboBox) evt.getSource();
        EditorSimulation selected = (EditorSimulation) tempComboBox.getSelectedItem();
        populateFields(selected);
}//GEN-LAST:event_dropdown_SelectedSimulationItemStateChanged

    private void populateFields(EditorSimulation p_simulation) {
        EditorSimulation tempSimulation = p_simulation;
        text_Author.setText(tempSimulation.getAuthor());
        text_Description.setText(tempSimulation.getDescription());
        text_Name.setText(tempSimulation.getName());
        text_LastModified.setText(tempSimulation.getLastModified());
        radio_Evolution_On.setSelected(tempSimulation.getEvolution());
        radio_Evolution_Off.setSelected(!tempSimulation.getEvolution());
        radio_Perishable_On.setSelected(tempSimulation.getPerishableVehicles());
        radio_Perishable_Off.setSelected(!tempSimulation.getPerishableVehicles());
        text_GeneticSelectionN.setText(Integer.toString(tempSimulation.getN()));
        selectedVehicleArray = tempSimulation.getEditorVehicleArray();
        selectedEnvironment = tempSimulation.getEnvironment();
        dropdown_GeneticSelectionMethod.setSelectedIndex(tempSimulation.getGeneticSelectionMethod() - 1);
        dropdown_ReproductionMethod.setSelectedIndex(tempSimulation.getReproductionMethod() - 1);
        addSelectedVehicles(selectedVehicleArray);
        setEnvironment(selectedEnvironment);
        proEnvironmentPreview.setEnvironment(selectedEnvironment);
}

    private void formWindowGainedFocus(WindowEvent evt) {//GEN-FIRST:event_formWindowGainedFocus
        dropdown_SelectedSimulation.requestFocus();        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowGainedFocus

    private void dropdown_ReproductionMethodItemStateChanged(ItemEvent evt) {//GEN-FIRST:event_dropdown_ReproductionMethodItemStateChanged
        //JComboBox tempComboBox = (JComboBox) evt.getSource();
        //EditorSimulation selected = (EditorSimulation) tempComboBox.getSelectedItem();
        //populateFields(selected);
    }//GEN-LAST:event_dropdown_ReproductionMethodItemStateChanged

    private void dropdown_GeneticSelectionMethodItemStateChanged(ItemEvent evt) {//GEN-FIRST:event_dropdown_GeneticSelectionMethodItemStateChanged
        //JComboBox tempComboBox = (JComboBox) evt.getSource();
        //EditorSimulation selected = (EditorSimulation) tempComboBox.getSelectedItem();
        //populateFields(selected);
    }//GEN-LAST:event_dropdown_GeneticSelectionMethodItemStateChanged

    private void list_AvailableVehiclesValueChanged(ListSelectionEvent evt) {//GEN-FIRST:event_list_AvailableVehiclesValueChanged
        selectedRobotsListSelectionChanged();
    }//GEN-LAST:event_list_AvailableVehiclesValueChanged

    private void processing_VehiclePreviewComponentResized(ComponentEvent evt) {//GEN-FIRST:event_processing_VehiclePreviewComponentResized
        proVehiclePreview.updateSize(processing_VehiclePreview.getWidth(), processing_VehiclePreview.getHeight());
}//GEN-LAST:event_processing_VehiclePreviewComponentResized

    private void radio_Evolution_OnItemStateChanged(ItemEvent evt) {//GEN-FIRST:event_radio_Evolution_OnItemStateChanged
        JRadioButton tempRadio = (JRadioButton) evt.getSource();
        boolean selected = tempRadio.isSelected();
        if(selected){
            evolutionOn();
        } else {
            evolutionOff();
        }
    }//GEN-LAST:event_radio_Evolution_OnItemStateChanged

    private void list_AvailableEnvironmentsValueChanged(ListSelectionEvent evt) {//GEN-FIRST:event_list_AvailableEnvironmentsValueChanged
        selectedEnvironmentListSelectionChanged();
    }//GEN-LAST:event_list_AvailableEnvironmentsValueChanged

    private void processing_EnvironmentPreviewComponentResized(ComponentEvent evt) {//GEN-FIRST:event_processing_EnvironmentPreviewComponentResized
        proEnvironmentPreview.updateSize(processing_EnvironmentPreview.getWidth(), processing_EnvironmentPreview.getHeight());
    }//GEN-LAST:event_processing_EnvironmentPreviewComponentResized

    private void tab_EnvironmentFocusGained(FocusEvent evt) {//GEN-FIRST:event_tab_EnvironmentFocusGained
        proEnvironmentPreview.start();
    }//GEN-LAST:event_tab_EnvironmentFocusGained

    private void tab_EnvironmentFocusLost(FocusEvent evt) {//GEN-FIRST:event_tab_EnvironmentFocusLost
        proEnvironmentPreview.destroy();
    }//GEN-LAST:event_tab_EnvironmentFocusLost

    @Action
    public void saveSimulation() {
        EditorSimulation s = (EditorSimulation) dropdown_SelectedSimulation.getSelectedItem();
        s.setName(text_Name.getText()); //set object attributes
		s.setAuthor(text_Author.getText());
		s.setDescription(text_Description.getText());
		s.setEnvironment(selectedEnv.get(0));
        s.addVehiclesFromArrayList(selectedRobots);
        boolean evolution = radio_Evolution_On.isSelected();
        s.setEvolution(evolution);
        boolean perishable = radio_Perishable_On.isSelected();
        s.setPerishableVehicles(perishable);
        GeneticSelectionMethod g = (GeneticSelectionMethod) dropdown_GeneticSelectionMethod.getSelectedItem();
        s.setGeneticSelectionMethod(g.getValue());
        ReproductionMethod r = (ReproductionMethod) dropdown_ReproductionMethod.getSelectedItem();
        s.setReproductionMethod(r.getValue());
        if(evolution && (g.getValue() == 2 || g.getValue() == 3) && r.getName().equals("Asexual")){
        	s.setN(Integer.parseInt(text_GeneticSelectionN.getText()));
        }
        else{
        	s.setN(0);
        }
		s.saveSimulation(); //convert object and its attributes into XML
        String lastModified = s.getLastModified();
        appRoot.setSimulationArray();
        simulationArray = appRoot.getSimulationArray();
        simulationDropDown = new DefaultComboBoxModel(simulationArray);
        for (int i = 0; i < simulationArray.length; i++) {
            if (simulationArray[i].getLastModified().equalsIgnoreCase(lastModified)) {
                s = simulationArray[i];
            }
        }
        dropdown_SelectedSimulation.setModel(simulationDropDown);
        dropdown_SelectedSimulation.requestFocus();
        dropdown_SelectedSimulation.setSelectedItem(s);
        SelectedRobotsModel selectedModel = (SelectedRobotsModel) list_SelectedVehicles.getModel();
        selectedRobots.clear();
        selectedModel.changed();
        populateFields(s);
    }

    @Action
    public void saveSimulationAs() {
        String filename = UtilMethods.formatString(text_Name.getText());
        EditorSimulation s = new EditorSimulation("xml/simulations/" + filename + ".sim", true);
        s.setName(text_Name.getText()); //set object attributes
		s.setAuthor(text_Author.getText());
		s.setDescription(text_Description.getText());
		s.setEnvironment(selectedEnv.get(0));
        s.addVehiclesFromArrayList(selectedRobots);
        boolean evolution = radio_Evolution_On.isSelected();
        s.setEvolution(evolution);
        boolean perishable = radio_Perishable_On.isSelected();
        s.setPerishableVehicles(perishable);
        GeneticSelectionMethod g = (GeneticSelectionMethod) dropdown_GeneticSelectionMethod.getSelectedItem();
        s.setGeneticSelectionMethod(g.getValue());
        ReproductionMethod r = (ReproductionMethod) dropdown_ReproductionMethod.getSelectedItem();
        s.setReproductionMethod(r.getValue());
        if(evolution && (g.getValue() == 2 || g.getValue() == 3) && r.getName().equals("Asexual")){
        	s.setN(Integer.parseInt(text_GeneticSelectionN.getText()));
        }
        else{
        	s.setN(0);
        }
		s.saveSimulation(); //convert object and its attributes into XML
        String lastModified = s.getLastModified();
        appRoot.setSimulationArray();
        simulationArray = appRoot.getSimulationArray();
        simulationDropDown = new DefaultComboBoxModel(simulationArray);
        for (int i = 0; i < simulationArray.length; i++) {
            if (simulationArray[i].getLastModified().equalsIgnoreCase(lastModified)) {
                s = simulationArray[i];
            }
        }
        dropdown_SelectedSimulation.setModel(simulationDropDown);
        dropdown_SelectedSimulation.requestFocus();
        dropdown_SelectedSimulation.setSelectedItem(s);
        SelectedRobotsModel selectedModel = (SelectedRobotsModel) list_SelectedVehicles.getModel();
        selectedRobots.clear();
        selectedModel.changed();
        populateFields(s);
    }

    @Action
    public void addSelectedVehicles() {
		SelectedRobotsModel selectedModel = (SelectedRobotsModel) list_SelectedVehicles.getModel();
		List<EditorVehicle> moves = getSelectedRobots();
		for (EditorVehicle move : moves) {
			selectedRobots.add(move);
		}
		selectedModel.changed();
    }

    
    public void addSelectedVehicles(EditorVehicle[] vehicles) {
		SelectedRobotsModel selectedModel = (SelectedRobotsModel) list_SelectedVehicles.getModel();
        selectedRobots.clear();
		for (EditorVehicle move : vehicles) {
			selectedRobots.add(move);
		}
		selectedModel.changed();
    }

    @Action
    public void addAllVehicles() {
        JList selectedList = list_AvailableVehicles;
		SelectedRobotsModel selectedModel = (SelectedRobotsModel) list_SelectedVehicles.getModel();
		for (EditorVehicle selected : availableRobots) {
			selectedRobots.add(selected);
        }
		selectedList.clearSelection();
		selectedModel.changed();
    }

    @Action
    public void removeSelectedVehicles() {
        JList selectedList = list_SelectedVehicles;
		SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();
		int sel[] = selectedList.getSelectedIndices();
		for (int i = 0; i < sel.length; i++) {
			selectedRobots.remove(sel[i] - i);
		}
		selectedList.clearSelection();
		selectedModel.changed();
    }

    @Action
    public void removeAllVehicles() {
        JList selectedList = list_SelectedVehicles;
		SelectedRobotsModel selectedModel = (SelectedRobotsModel) selectedList.getModel();
		selectedRobots.clear();
		selectedList.clearSelection();
		selectedModel.changed();
    }

    @Action
    public void setEnvironment() {
        SelectedEnvironmentsModel selectedModel = (SelectedEnvironmentsModel) list_SelectedEnvironment.getModel();
		List<Environment> moves = getSelectedEnvironments();
        selectedEnv.clear();
		for (Environment move : moves) {
			selectedEnv.add(move);
		}
		selectedModel.changed();
    }

    public void setEnvironment(Environment env) {
        SelectedEnvironmentsModel selectedModel = (SelectedEnvironmentsModel) list_SelectedEnvironment.getModel();
		selectedEnv.clear();
        selectedEnv.add(env);
		selectedModel.changed();
    }

    @Action
    public void evolutionOff() {
        dropdown_GeneticSelectionMethod.setEnabled(false);
        dropdown_ReproductionMethod.setEnabled(false);
        text_GeneticSelectionN.setEnabled(false);
    }

    @Action
    public void evolutionOn() {
        dropdown_GeneticSelectionMethod.setEnabled(true);
        dropdown_ReproductionMethod.setEnabled(true);
        text_GeneticSelectionN.setEnabled(true);
    }

    public List<EditorVehicle> getSelectedRobots() {
		List<EditorVehicle> selected = new ArrayList<EditorVehicle>();
		for (int i : list_AvailableVehicles.getSelectedIndices()) {
			selected.add(availableRobots.get(i));
		}
		return selected;
	}

    public List<Environment> getSelectedEnvironments() {
		List<Environment> selected = new ArrayList<Environment>();
		for (int i : list_AvailableEnvironments.getSelectedIndices()) {
			selected.add(availableEnv.get(i));
		}
		return selected;
	}

    public int getSelectedRobotsCount() {
		return selectedRobots.size();
	}

    class SelectedRobotsModel extends AbstractListModel {
		public void changed() {
			fireContentsChanged(this, 0, getSize());
		}

		public int getSize() {
			return selectedRobots.size();
		}

		public EditorVehicle getElementAt(int which) {
			return selectedRobots.get(which);
		}
	}

    private class AvailableRobotsModel extends AbstractListModel {
		public void changed() {
			fireContentsChanged(this, 0, getSize());
		}

		public int getSize() {
			return availableRobots.size();
		}

		public EditorVehicle getElementAt(int which) {
			return availableRobots.get(which);
		}
	}

     class SelectedEnvironmentsModel extends AbstractListModel {
		public void changed() {
			fireContentsChanged(this, 0, getSize());
		}

		public int getSize() {
			return selectedEnv.size();
		}

		public Environment getElementAt(int which) {
			return selectedEnv.get(which);
		}
	}

    private class AvailableEnvironmentsModel extends AbstractListModel {
		public void changed() {
			fireContentsChanged(this, 0, getSize());
		}

		public int getSize() {
			return availableEnv.size();
		}

		public Environment getElementAt(int which) {
			return availableEnv.get(which);
		}
	}

	private void selectedRobotsListSelectionChanged() {
		int sel[] = list_AvailableVehicles.getSelectedIndices();

		if (sel.length == 1) {
			EditorVehicle veh = ((EditorVehicle) list_AvailableVehicles.getModel().getElementAt(sel[0]));
			showVehicleDescription(veh);
		} else {
			jTextArea1.setText(null);
		}
	}

    private void selectedEnvironmentListSelectionChanged() {
		int sel[] = list_AvailableEnvironments.getSelectedIndices();

		if (sel.length == 1) {
			Environment env = ((Environment) list_AvailableEnvironments.getModel().getElementAt(sel[0]));
			showEnvironmentDescription(env);
            proEnvironmentPreview.setEnvironment(env);
		} else {
			jTextArea2.setText(null);
		}
	}

    public void showVehicleDescription(EditorVehicle veh) {
		jTextArea1.setText(veh.getDescription());
        proVehiclePreview.updateColor(veh.getVehicleColourRed(),
                                        veh.getVehicleColourGreen(),
                                        veh.getVehicleColourBlue());
	}
    
    public void showEnvironmentDescription(Environment env) {
		jTextArea2.setText(env.getDescription());
	}

    @Action
    public void reloadVehiclesList() {
        vehicleArray = appRoot.getVehicleArray();
        availableRobots.clear();
        for (int i = 0; i < vehicleArray.length; i++) {
            availableRobots.add(i, vehicleArray[i]);
        }
        AvailableRobotsModel selectedModel = (AvailableRobotsModel) list_AvailableVehicles.getModel();
        selectedModel.changed();
        EditorSimulation s = (EditorSimulation) dropdown_SelectedSimulation.getSelectedItem();
        populateFields(s);
        dropdown_SelectedSimulation.requestFocus();
        selectedRobotsListSelectionChanged();
    }

    @Action
    public void reloadEnvironmentsList() {
        environmentArray = appRoot.getEnvironmentArray();
        availableEnv.clear();
        for (int i = 0; i < environmentArray.length; i++) {
            availableEnv.add(i, environmentArray[i]);
        }
        AvailableEnvironmentsModel selectedModel = (AvailableEnvironmentsModel) list_AvailableEnvironments.getModel();
        selectedModel.changed();
        EditorSimulation s = (EditorSimulation) dropdown_SelectedSimulation.getSelectedItem();
        populateFields(s);
        dropdown_SelectedSimulation.requestFocus();
        selectedEnvironmentListSelectionChanged();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private ButtonGroup buttonGroup_Evolution;
    private ButtonGroup buttonGroup_PerishableVehicles;
    private JButton button_AddAllVehicle;
    private JButton button_AddVehicle;
    private JButton button_Cancel;
    private JButton button_ReloadEnv;
    private JButton button_ReloadVeh;
    private JButton button_RemoveAllVehicle;
    private JButton button_RemoveVehicle;
    private JButton button_Save;
    private JButton button_SaveAsNew;
    private JButton button_SetEnvironment;
    private JComboBox dropdown_GeneticSelectionMethod;
    private JComboBox dropdown_ReproductionMethod;
    private JComboBox dropdown_SelectedSimulation;
    private JScrollPane jScrollPane1;
    private JScrollPane jScrollPane2;
    private JTextArea jTextArea1;
    private JTextArea jTextArea2;
    private JLabel label_GeneticSelectionMethod;
    private JLabel label_GeneticSelectionN;
    private JLabel label_ReproductionMethod;
    private JList list_AvailableEnvironments;
    private JList list_AvailableVehicles;
    private JList list_SelectedEnvironment;
    private JList list_SelectedVehicles;
    private JPanel panel_AddRemoveVehicles;
    private JPanel panel_Author;
    private JPanel panel_AvailableEnvironments;
    private JPanel panel_AvailableVehicles;
    private JPanel panel_Configuration;
    private JPanel panel_Description;
    private JPanel panel_EnvironmentPreview;
    private JPanel panel_Evolution;
    private JPanel panel_LastModified;
    private JPanel panel_Name;
    private JPanel panel_PerishableVehicles;
    private JPanel panel_SelectedEnvironment;
    private JPanel panel_SelectedSimulation;
    private JPanel panel_SelectedVehicles;
    private JPanel panel_SetEnvironment;
    private JPanel panel_VehiclePreview;
    private JPanel processing_EnvironmentPreview;
    private JPanel processing_VehiclePreview;
    private JRadioButton radio_Evolution_Off;
    private JRadioButton radio_Evolution_On;
    private JRadioButton radio_Perishable_Off;
    private JRadioButton radio_Perishable_On;
    private JScrollPane scrollpanel_AvailableEnvironments;
    private JScrollPane scrollpanel_AvailableVehicles;
    private JScrollPane scrollpanel_Description;
    private JScrollPane scrollpanel_SelectedEnvironment;
    private JScrollPane scrollpanel_SelectedVehicles;
    private JTabbedPane tabContainer;
    private JPanel tab_Environment;
    private JPanel tab_Properties;
    private JPanel tab_Vehicles;
    private JTextField text_Author;
    private JTextArea text_Description;
    private JTextField text_GeneticSelectionN;
    private JTextField text_LastModified;
    private JTextField text_Name;
    private JTextField text_Status;
    // End of variables declaration//GEN-END:variables
    private VehiclePreview proVehiclePreview;
    private EnvironmentPreview proEnvironmentPreview;
    private EditorSimulation[] simulationArray;
    private EditorVehicle[] vehicleArray, selectedVehicleArray;
    private Environment[] environmentArray;
    private Environment selectedEnvironment;
    private DefaultComboBoxModel simulationDropDown, genSelDropDown, repoDropDown;
    private Simulator appRoot;
    private AbstractListModel availableVehicles, availableEnvironments, selectedVehicles, selectedEnvironments;


    private final List<EditorVehicle> selectedRobots = new ArrayList<EditorVehicle>();
    private final List<Environment> selectedEnv = new ArrayList<Environment>();

    private final List<EditorVehicle> availableRobots = new CopyOnWriteArrayList<EditorVehicle>();
    private final List<Environment> availableEnv = new CopyOnWriteArrayList<Environment>();

    GeneticSelectionMethod[] genSelArray;
    ReproductionMethod[] repoArray;
}
